// 防抖
export function debounce(fn, wait) {
  let time = null
  return function() {
    const this_ = this
    clearTimeout(time)
    time = setTimeout(() => {
      fn.apply(this_)
    }, wait)
  }
}
// 节流
export function deboun(fn, wait) {
  let time = null
  let flag = true
  return function() {
    if (!flag) return
    flag = false
    const this_ = this
    clearTimeout(time)
    time = setTimeout(() => {
      fn.apply(this_)
      flag = true
    }, wait)
  }
}
